package com.byedu.model.enums;

public enum GenderTypeEnum {
    MALE(0, "男"),
    FMALE(1, "女"),
    UKNOWN_GENDER(2, "未知");

    private int code;
    private String value;

    //自定义的构造函数，参数数量，名字随便自己取
    //构造器默认也只能是private, 从而保证构造函数只能在内部使用
    private GenderTypeEnum(int code, String value) {
        this.code = code;
        this.value = value;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    //重新toString方法，默认的toString方法返回的就是枚举变量的名字，和name()方法返回值一样
    @Override
    public String toString() {
        return this.code + ":" + this.value;
    }
}
